﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Net.Mail;
using System.Web.Services;
using AjaxControlToolkit;
using System.IO.MemoryMappedFiles;
public partial class admin_admin_account_information : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Response.Redirect("sessiont.aspx");
        }
        Label2.Text = Session["email"].ToString();
        if (Page.IsPostBack)
        {
        }
        else
        {


            SqlConnection conn = null;
            conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
            conn.Open();
            SqlCommand scmd = new SqlCommand("SELECT * FROM admin1 where username='" + Session["email"] + "'", conn);

            SqlDataReader dr = scmd.ExecuteReader();
            if (dr.Read())
            {


                txtfname1.Text = dr[0].ToString();
                txtmname.Text = dr[2].ToString();
                txtlname1.Text = dr[1].ToString();



            }


            dr.Close();

        }

    }
    protected void Save_Click(object sender, EventArgs e)
    {
        SqlConnection conn = null;
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn.Open();

        SqlCommand cm1 = new SqlCommand("update admin1 set username='" + txtfname1.Text + "', email='" + txtmname.Text + "',pass ='" + txtlname1.Text + "' where username='" + Session ["email"] + "'", conn);
        cm1.ExecuteNonQuery();
        Response.Redirect("admin_update_info_conf.aspx");
        conn.Close();

    }

    protected void LinkButton1_Click(object sender, System.EventArgs e)
    {
        Session.Abandon();
        Response.Redirect("../admin.aspx");
    }
    protected void Cancel_Click(object sender, EventArgs e)
    {

    }
}